using System;
using System.Net.Sockets;

namespace Stunt.Nutss.Stunt
{

	/// <summary>
	/// A null implementation of all the socket events, which can be adapted by other classes.
	/// </summary>
	public class STUNTEventAdapter : ISTUNTEventListener
	{

		#region ErrorHandler

		public virtual void ErrorHandler(Exception e)
		{
		}

		#endregion

		#region AcceptHandler

		public virtual void AcceptHandler(Socket s, NutssUri u)
		{

			try
			{
				s.Close();
			}

			catch (Exception)
			{
			}
		}

		#endregion

		#region ConnectHandler

		public virtual void ConnectHandler(Socket s)
		{

			try
			{
				s.Close();
			}

			catch (Exception)
			{
			}
		}

		#endregion

		#region ConnectUDPHandler

		public void ConnectUDPHandler(Socket s)
		{

			try
			{
				s.Close();
			}

			catch (Exception)
			{ }
		}

		#endregion

		#region ConnectTCPHandler

		public void ConnectTCPHandler(Socket s)
		{
			ConnectHandler(s);
		}

		#endregion

		#region AcceptUDPHandler

		public void AcceptUDPHandler(Socket s, NutssUri u)
		{

			try
			{
				s.Close();
			}

			catch (Exception)
			{ }
		}

		#endregion

		#region AcceptTCPHandler

		public void AcceptTCPHandler(Socket s, NutssUri u)
		{
			AcceptHandler(s, u);
		}

		#endregion

	}
}